{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="ibox float-e-margins">
        <div class="ibox-content">
            <div class="row">
                <!--搜索框开始-->

                <!--搜索框结束-->
                <!--操作框开始-->
                <!--<div class="col-sm-12">-->
                <!--<div class="input-group" >-->
                <!--<button  class="btn btn-danger m-l-xs" href="javascript:;" data-toggle="dropdown">-->
                <!--<i class="fa fa-wrench"></i> 导出 <span class="caret"></span>-->
                <!--</button>-->
                <!--<ul class="dropdown-menu layui-anim layui-anim-upbit" role="menu">-->
                <!--<li><a  href="javascript:;" class="layuiBtn" data-type="excelAll"><i class="fa fa-print"></i> 导出汇总</a></li>-->
                <!--<li><a  href="javascript:;" class="layuiBtn" data-type="excelAllDetail"><i class="fa fa-print"></i> 导出明细</a></li>-->
                <!--</ul>-->
                <!--</div>-->
                <!--</div>-->
                <!--操作框结束-->
                <div class="col-sm-12">
                    <div class="input-group" >
                        <input type="text" disabled class="layui-input" id="tongji1" value="" style="border:1px solid red;color: red;width: 400px;" />
                    </div>
                </div>
            </div>

            <div class="hr-line-dashed"></div>

            <div class="example-wrap">
                <div class="example">
                    <table class="layui-hide" id="test" lay-filter="testReload"></table>
                    <script type="text/html" id="imgTpl2">
                        <ul class="aaasss">
                            {{#  layui.each(d.info_img, function(index, item){ }}
                            <img src="{{item}}" data-original="{{item}}" class="table-img" onerror="this.src='/static/admin/images/head_default.gif'"  />
                            {{#  }); }}
                        </ul>
                    </script>
                    <!--操作模板-->
                </div>
            </div>
        </div>
    </div>
</div>
<textarea id="allidsForOut" class="hidden"></textarea>
{include file="public/footer" /}
<script>
    //layui渲染数据表格
    layui.use('table', function () {
        var table = layui.table
            , form = layui.form;
        table.render({
            elem: '#test'
            , url: '{:url("Order/orderInfo")}'
            , response: {
                statusCode: 220 //成功的状态码，默认：0
            }
            , page: true
//            , size: 'lg' //sm小尺寸的表格 lg大尺寸
            , where: {'info_s_id':{$info_s_id},'type':{$type}}
            , cellMinWidth: 150
            , limits: [5, 10, 15, 20, 25, 30]
            , limit: "{:config('pages')}"
            , loading: true
            , id: 'testReload'
            , cols: [[
                {type: 'checkbox', fixed: 'left',}
                , {type: 'numbers', width: 80, title: '序号'}
                , {field: 'case_name', width: '', title: '所属案例', align: 'center'}
                , {field: 'info_designer', width: '', title: '设计师', align: 'center'}
                , {field: 'info_info', width: '', title: '订单情况', align: 'center'}
                , {field: 'info_money', width: '', title: '订单金额', align: 'center'}
                , {field: 'info_img', width: '', title: '现场照片', align: 'center',templet: '#imgTpl2'}
                , {field: 'info_time', width: '', title: '上传时间', align: 'center'}
            ]]
            , done: function (res, curr, count) {
                $('.aaasss').viewer({
                    url: 'data-original',
                });
                $('#tongji1').val('当前条件下总金额：'+res.allmoney+'元          总数量：'+res.allnums);
            }
        });
        //监听状态开关操作
        form.on('switch(OnOff)', function (obj) {
            var num = '';
            obj.elem.checked == true? num = 1: num = 2;
            //用户状态
            wk.status(this.value,num, '{:url("changeGoodStatus")}',obj);
        });
        //批量操作
        var $ = layui.$, active = {
            excelAll: function(){
                //导出Excel
                wk.excelAll('',$('.layui-input').serialize(),"{:url('excelOutOrder')}");
            },
            excelAllDetail: function(){
                //导出Excel
                wk.excelAll('',$('.layui-input').serialize(),"{:url('excelOutDetail')}");
            }
        };
        $('.layuiBtn').on('click', function () {
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
        });
        var getIds = function () {
            var ids = [];
            var checkStatus = table.checkStatus('testReload')
                , data = checkStatus.data;
            $.each(data, function (index, item) {
                ids.push(item['n_id'])
            });
            return ids;
        }
    });
</script>
</body>
</html>